package com.dpj.book.pojo;

import java.math.BigDecimal;

public class CartItem {
    private Integer id;
    private Book book;
    private  Integer buyCount;
    private  User userBean;
    private double cartItemMoney;

    public double getCartItemMoney() {
        BigDecimal bigDecimalPrice=new BigDecimal(getBook().getPrice()+"");
        BigDecimal bigDecimalBuyCount=new BigDecimal(this.buyCount+"");
        BigDecimal bigdecimalTotal = bigDecimalPrice.multiply(bigDecimalBuyCount);
        cartItemMoney=bigdecimalTotal.doubleValue();
        return cartItemMoney;
    }

    public void setCartItemMoney(double cartItemMoney) {
        this.cartItemMoney = cartItemMoney;
    }

    @Override
    public String toString() {
        return "CartItem{" +
                "id=" + id +
                ", book=" + book +
                ", buyCount=" + buyCount +
                ", userBean=" + userBean +
                '}';
    }

    public CartItem() {
    }

    public CartItem(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public Integer getBuyCount() {
        return buyCount;
    }

    public void setBuyCount(Integer buyCount) {
        this.buyCount = buyCount;
    }

    public User getUserBean() {
        return userBean;
    }

    public void setUserBean(User userBean) {
        this.userBean = userBean;
    }
}
